# Gridgen Journal File V1 (Gridgen 15.09 REL 3)
# Created Fri Aug 28 23:22:25 2009
#
package require PWI_Glyph 1.6.9

# Delete any existing grids and database entities.  Reset AS/W, defaults, and
# tolerances.
gg::memClear
gg::aswDeleteBC -glob "*"
gg::aswDeleteVC -glob "*"
gg::aswSet GENERIC -dim 3
gg::defReset
gg::tolReset
# Delay screen updates and checking for user input until script is finished.
gg::updatePolicy DELAYED

# import database
gg::dbImport "D:/lidz/My Documents/icemcfd/Copy of test/surf.net" -type NET

# create connector on database
gg::conOnDBEnt ALL
# redimionsion X dir edge
set _CN(1) [lindex [gg::conGetAll] 0]
set _CN(3) [lindex [gg::conGetAll] 2]
set _CN(15) [lindex [gg::conGetAll] 10]
set _CN(19) [lindex [gg::conGetAll] 11]
gg::conDim [list \
    $_CN(1) \
    $_CN(3) \
    $_CN(15) \
    $_CN(19) \
  ] 20

# redimionsion Y dir edge
set _CN(2) [lindex [gg::conGetAll] 1]
set _CN(4) [lindex [gg::conGetAll] 3]
set _CN(7) [lindex [gg::conGetAll] 5]
set _CN(11) [lindex [gg::conGetAll] 8]
gg::conDim [list \
    $_CN(2) \
    $_CN(4) \
    $_CN(7) \
    $_CN(11) \
  ] 30

# redimionsion Y dir edge
set _CN(6) [lindex [gg::conGetAll] 4]
set _CN(8) [lindex [gg::conGetAll] 6]
set _CN(10) [lindex [gg::conGetAll] 7]
set _CN(12) [lindex [gg::conGetAll] 9]
gg::conDim [list \
    $_CN(6) \
    $_CN(8) \
    $_CN(10) \
    $_CN(12) \
  ] 17

# z spaceing at the surface
gg::conBeginSpacing [list \
    $_CN(6) \
    $_CN(8) \
    $_CN(10) \
    $_CN(12) \
  ] 10

#create domain
gg::domBegin -type STRUCTURED
  gg::edgeBegin
    gg::edgeAddCon $_CN(4)
  gg::edgeEnd
  gg::edgeBegin
    gg::edgeAddCon $_CN(3)
  gg::edgeEnd
  gg::edgeBegin
    gg::edgeAddCon $_CN(2)
  gg::edgeEnd
  gg::edgeBegin
    gg::edgeAddCon $_CN(1)
  gg::edgeEnd
set _DM(1) [gg::domEnd]
gg::domBegin -type STRUCTURED
  gg::edgeBegin
    gg::edgeAddCon $_CN(8)
  gg::edgeEnd
  gg::edgeBegin
    gg::edgeAddCon $_CN(15)
  gg::edgeEnd
  gg::edgeBegin
    gg::edgeAddCon $_CN(12)
  gg::edgeEnd
  gg::edgeBegin
    gg::edgeAddCon $_CN(1)
  gg::edgeEnd
set _DM(2) [gg::domEnd]
gg::domBegin -type STRUCTURED
  gg::edgeBegin
    gg::edgeAddCon $_CN(6)
  gg::edgeEnd
  gg::edgeBegin
    gg::edgeAddCon $_CN(19)
  gg::edgeEnd
  gg::edgeBegin
    gg::edgeAddCon $_CN(10)
  gg::edgeEnd
  gg::edgeBegin
    gg::edgeAddCon $_CN(3)
  gg::edgeEnd
set _DM(3) [gg::domEnd]
gg::domBegin -type STRUCTURED
  gg::edgeBegin
    gg::edgeAddCon $_CN(10)
  gg::edgeEnd
  gg::edgeBegin
    gg::edgeAddCon $_CN(11)
  gg::edgeEnd
  gg::edgeBegin
    gg::edgeAddCon $_CN(12)
  gg::edgeEnd
  gg::edgeBegin
    gg::edgeAddCon $_CN(2)
  gg::edgeEnd
set _DM(4) [gg::domEnd]
gg::domBegin -type STRUCTURED
  gg::edgeBegin
    gg::edgeAddCon $_CN(6)
  gg::edgeEnd
  gg::edgeBegin
    gg::edgeAddCon $_CN(7)
  gg::edgeEnd
  gg::edgeBegin
    gg::edgeAddCon $_CN(8)
  gg::edgeEnd
  gg::edgeBegin
    gg::edgeAddCon $_CN(4)
  gg::edgeEnd
set _DM(5) [gg::domEnd]
gg::domBegin -type STRUCTURED
  gg::edgeBegin
    gg::edgeAddCon $_CN(7)
  gg::edgeEnd
  gg::edgeBegin
    gg::edgeAddCon $_CN(19)
  gg::edgeEnd
  gg::edgeBegin
    gg::edgeAddCon $_CN(11)
  gg::edgeEnd
  gg::edgeBegin
    gg::edgeAddCon $_CN(15)
  gg::edgeEnd
set _DM(6) [gg::domEnd]

# surface solver
set _ggTemp_(1) [list $_DM(1)]
gg::domEllSolverBegin $_ggTemp_(1)
  gg::domEllSolverStep -iterations 100 -nodisplay
gg::domEllSolverEnd
unset _ggTemp_(1)
set _ggTemp_(2) [list $_DM(1) $_DM(2) $_DM(3) $_DM(4) $_DM(5) $_DM(6)]
gg::domEllSolverBegin $_ggTemp_(2)
  gg::domEllSolverStep -iterations 100 -nodisplay
gg::domEllSolverEnd
unset _ggTemp_(2)

# create block
gg::blkBegin -type STRUCTURED
  gg::faceBegin
    gg::faceAddDom $_DM(1)
  gg::faceEnd
  gg::faceBegin
    gg::faceAddDom $_DM(2)
  gg::faceEnd
  gg::faceBegin
    gg::faceAddDom $_DM(5)
  gg::faceEnd
  gg::faceBegin
    gg::faceAddDom $_DM(3)
  gg::faceEnd
  gg::faceBegin
    gg::faceAddDom $_DM(4)
  gg::faceEnd
  gg::faceBegin
    gg::faceAddDom $_DM(6)
  gg::faceEnd
set _BL(1) [gg::blkEnd]

#block solver
set _ggTemp_(3) [list $_BL(1)]
gg::blkEllSolverBegin $_ggTemp_(3)
  gg::blkEllSolverStep -iterations 100 -nodisplay
gg::blkEllSolverEnd
unset _ggTemp_(3)

#set i,j,k align to x,y,z
gg::blkSpecifyIJK $_BL(1) 2 3 1
